package com.xiang.producer;

import com.xiang.RabbitmqApplication;
import com.xiang.config.RabbitMqTopicConfig1;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;

/**
 * 生产者
 *
 * @author: xiangtianlei
 * @Date: 2022-9-2
 */
@SpringBootTest(classes = RabbitmqApplication.class)
@RunWith(SpringRunner.class)
public class ProducerTopicsTest1 {

    @Resource
    RabbitTemplate rabbitTemplate;

    @Test
    public void producerTopics() throws InterruptedException {
        /**
         *  1、交换机名称
         *  2、routingKey
         *  3、发送内容
         */
//        rabbitTemplate.convertAndSend(RabbitMqTopicConfig1.EXCHANGE_TOPICS, "xiang.email.lei", "xiang.email.lei");//
//        rabbitTemplate.convertAndSend(RabbitMqTopicConfig1.EXCHANGE_TOPICS, "xiang.email.ee", "xiang.email.ee");
//        rabbitTemplate.convertAndSend(RabbitMqTopicConfig1.EXCHANGE_TOPICS, "xiang.email.aaa.bbb", "xiang.email.aaa.bbb");//
//        rabbitTemplate.convertAndSend(RabbitMqTopicConfig1.EXCHANGE_TOPICS, "xiang.email.tian", "xiang.email.tian");
//        rabbitTemplate.convertAndSend(RabbitMqTopicConfig1.EXCHANGE_TOPICS, "xiang.sms.vv", "xiang.sms.vv");
//        rabbitTemplate.convertAndSend(RabbitMqTopicConfig1.EXCHANGE_TOPICS, "xiang.sms.tian", "xiang.sms.tian");//
        rabbitTemplate.convertAndSend(RabbitMqTopicConfig1.EXCHANGE_TOPICS, "xiang.sms.tian.bbb", "xiang.sms.tian.bbb");
//        rabbitTemplate.convertAndSend(RabbitMqTopicConfig1.EXCHANGE_TOPICS, "test.aa.sms.tian", "test.aa.sms.tian");
    }

}
